package com.ethink.order.converter;

import com.ethink.framework.common.converter.Converter;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import com.ethink.order.api.info.PurchaseOrderInfo;
import com.ethink.order.common.entity.PurchaseOrder;

/**
 * 采购单 Converter转换器
 *
 * @author default
 * @date 2022-11-11
 */
@Component
public class PurchaseOrderConverter implements Converter<PurchaseOrderInfo, PurchaseOrder> {

    @Override
    public PurchaseOrder convertTo(PurchaseOrderInfo info) {
        if(info == null) {
            return null;
        }
        PurchaseOrder entity = new PurchaseOrder ();
        BeanUtils.copyProperties(info, entity);
        return entity;
    }

    @Override
    public PurchaseOrderInfo convertFrom(PurchaseOrder entity) {
        if(entity == null) {
            return null;
        }
        PurchaseOrderInfo info = new PurchaseOrderInfo();
        BeanUtils.copyProperties(entity, info);
        return info;
    }
}
